
# library(pacman)
# p_load(dplyr, tidyr, DBI, RSQLite) 
library(dplyr)
library(tidyr)
library(DBI)
library(RSQLite)

con <- dbConnect(RSQLite::SQLite(), "iso_standards.sqlite") # Open database

standards <- dbReadTable(con, "standards_status") # Extract dataset with standards

dbDisconnect(con) # Disconnect from database

data_figure1 <- standards %>%
  group_by(year) %>%
  count() %>% # Count number of standards per year
  ungroup() %>%
  drop_na() %>% # Remove missing elements
  filter(year <= 2021) %>% # Last scraping per publication makes 2022 and 2023 less representative, because not as many standards were published that recently
  mutate(aggcount = cumsum(n)) # Find the cumulative sum

# Annotated figure made with Datawrapper interface: https://www.datawrapper.de/ 